import random
def a001():
    n=0
    mm=0
    while n<1000:
        n+=1
        a,b,c,d,e,f,g=0,0,0,0,0,0,0
        m=0
        while m<12:
            m+=1
            d=0
            while d==0:
                c=random.randint(0,6)
                if c==0:
                    if a<2:
                        a+=1
                        d=1
                if c==1:
                    if b<2:
                        b+=1
                        d=1
                if c==2:
                    if c<2:
                        c+=1
                        d=1
                if c==3:
                    if d<2:
                        d+=1
                        d=1
                if c==4:
                    if e<2:
                        e+=1
                        d=1
                if c==5:
                    if f<2:
                        f+=1
                        d=1
                if c==6:
                    if g<2:
                        g+=1
                        d=1

        if a==0 or b==0 or c==0 or d==0 or e==0 or f==0 or g==0:
            mm+=1
    print(mm)

class a002():

    def suan(x,y,z,n):
        while n>0:
            n-=1
            cho=random.randint(0,2)
            if cho==0:
                n+=0
            if cho==0:
                x+=1
            if cho==1:
                y+=1
            if cho==2:
                z+=1
        return(x,y,z)
    m=1000000
    bu=0    
    huan=0
    while m>0:
        a,b,c=0,0,0
        e,f,g=0,0,0
        m-=1
        h=suan(a,b,c,1)
        d=suan(e,f,g,1)
        #print(h,d,h[0],d[0])
        if h[0]==d[0]==1 or h[1]==d[1]==1 or h[2]==d[2]==1:
            bu+=1
        if h[0]==d[1]==1 or h[1]==d[0]==1 or h[1]==d[2]==1 or h[0]==d[2]==1 or h[2]==d[1]==1 or h[2]==d[0]==1:
            huan+=1
    print(bu,huan,huan/1000000,bu/1000000)
    """
    #if c==0:
    #                if a<2:
     #                   d=1
    # 
    #==1 
    #can you can a can as a canner can can a can

    """

def a003():
    f=100
    a=[]
    for i in range(f+1):
        a.append(0)
    b,c=[],[]
    n=100000
    while n>0:
        n-=1
        m=0
        b,c=[],[]
        for i in range(f):
            b.append(random.randint(1,2))
            c.append(random.randint(1,2))
            if b[i]==c[i]:
                m+=1
        a[m]+=1
    print(a,n)
    import pygame
    pygame.init()
    screen=pygame.display.set_mode([640,640])
    screen.fill([255,255,255])
    for i in range(f):
        pygame.draw.rect(screen,[255,0,0],[i*(600/f),640-a[i]/10+50,10,10],0)
    pygame.display.flip()
    running=True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running=False
    pygame.quit()

def a004():
    import random
    import time
    ci=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," "]
    for i in range (int(input("次数？"))):
        m=100
        n=m
        c=[]
        print("Q:",end="")
        #b=int(input("1.time 2.all"))
        b=1
        while n>0:
            a=random.randint(0,4)
            if a<4:
                c.append(ci[random.randint(0,25-25)])
            if a==4:
                c.append(ci[26])
        
            print(c[m-n] , end="" )
            n-=1
        print("")
    
        e=time.time()
        f=str(input("A:"))
        if b==1:
           e2=time.time() 
           e3=e2-e
           n=m
           good=0
           while n>0 and len(f)-m+n>0:
                if f[m-n]==c[m-n]:
                    good+=1
                n-=1
        print(f"时间:{e3},正确个数:{good},正确率{good/m},速度{(m/e3)*60}每分钟")
        time.sleep(3)
    '''    if b==2:
            pass'''

def a005():
    import random,time
    qian=1
    zhuan=0
    tou=1
    ci=0
    hang=0
    while zhuan<10 and qian>0:
        qian-=tou
        a=random.randint(0,13)
        if a==6:
            zhuan+=1
            qian+=2*tou
            tou=1
        
        else:
            tou+=0.7*tou
    
        if qian<1:
            hang=-qian+1
            qian+=hang
        if hang>0:

            if qian>1:
                qian-=hang
                hang=0
            if qian==1:
                hang+=0.1*hang
        ci+=1
        print(f"钱：{qian}，赚到钱的次数：{zhuan}，投资钱数：{tou}，次数：{ci}，欠钱:{hang}")
        time.sleep(1)
    print(qian)
    #201714962.46871814


def a006():
    p1=[100,50,[],[],[0,0,0,0,0,0,0,0,0,0],[],[],[],[],1000]
    p2=[100,50,[],[],[],[],[],[],[],1000]
    ci=[
        ['a1','市场',4,[5,'q',2,2,'w',5,'m'],[10,'q',2,5,'w',10,'m'],[20,'q',3,5,'w',20,'m',5,'t'],[40,'q',3,4,'w',30,'m',10,'t']],
        ['a2','集市',4,[20,'q',4,17,'w',10,'m',3,'t',10,'q'],[40,'q',4,14,'w',40,'m',7,'t',50,'q'],[60,'q',4,11,'w',100,'m',30,'t',100,'q'],[100,'q',4,8,'w',150,'m',45,'t',180,'q']]
    ]

    def du(a):
        b=str (a[0])
        c=str(a[1])
        d=int(a[2])
        f=d
        e=[]
        while d>0:
            d-=1
            e.append (a[f-d+2][1])
        print(b,c,d,e,f,)
    du(ci[1])
#a006()
    #玩家[血量，基地范围w，发射炮弹【什么+位置+血量+速度】，基地基建【、
    #物品+数量+空间位】，【钱q，木头m，铁矿t，稀有矿xk，石油s，集成电路j，高级集成电路gj，电力d，铀235y，反物质f10】，
    # 【依存炮弹【榴弹】【火箭炮】
    # 【液氢炸弹】【电磁炮】【洲际导弹】
    # 【核弹】【反物质导弹】7】，【在干什么】，【科技点，科技值，微观物理】,加成【】，敌军与我的距离]‘
    #   [[5q[2d,5m]],[],[],[]]
#image.png

    #附表       等级、4、 转的东西   占地  升级材料
    #集市   1.30qian.10.20mu.0tie      2.50.15.40.10     3.75.10.100.50     4.150.10.300.200
    #伐木场     1.5mu.20.2.tie.2qian   2.10.15.10.10     3.20.12.30.30      4.50.10.50.50
    #小矿井  1.2铁.1.5木.5钱    2.3.2.5.5     3.5.3.10.10     4.8.3.10.10
    #大矿井  
    #机械开矿
    #扩建基地
    #中小规模集成电路生产商
    #大规模集成电路生产商
    #1纳米集成电路生产商
    #石油探测
    #石油钻探
    #石油抽取
    #火力发电厂
    #核电站
    #光伏发电
    #风力发电
    #科研所
    #巨变发电
    #物理研究所
    #巨型强子对撞机
    #反物质制造所
    #固体燃料
    #液体燃料
    #火药
    #卫星
    #武器制造总局
    #   原子弹
    #   氢弹
    #
    #宇宙反作用力发电机
    #  #####
#市场     1.5钱.2.5木      2.10.5.10       3.25.5.20.5铁     4.50.4.30.10


def a007():
    p1=[100,[0,1],[1,1],[],[0,0],[]]
    p2=[100,[0,1],[1,1],[],[0,0],[]]
    run=True
    while run:
        print('')
































